package com.i8office.android.zhihuixinwu.module.presenter;

import com.cyan.tools.callback.SimpleCallback;
import com.i8office.android.zhihuixinwu.module.contract.CalendarContract;
import com.i8office.android.zhihuixinwu.module.model.CalendarModel;
import com.i8office.android.zhihuixinwu.ui.schedule.LeaderData;
import com.i8office.android.zhihuixinwu.ui.schedule.Meetting;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ChooseMeettingPresenter extends BasePresenterImpl<CalendarContract.ChooseMeettingView> implements CalendarContract.ChooseMeettingPresenter {
    private CalendarContract.Model model;

    public ChooseMeettingPresenter(CalendarContract.ChooseMeettingView view) {
        super(view);
        model = new CalendarModel();

    }


    @Override
    public void getMeettings(String date, String emplId) {
        Map<String, String> params = new HashMap<>();
        params.put("date", date);
        params.put("emplId", emplId);
        addDisposable(model.getMeettings(new SimpleCallback<List<Meetting>>(mView) {
            @Override
            public void requestError(String msg) {
                super.requestError(msg);
                mView.toast(msg);
            }

            @Override
            public void requestSuccess(List<Meetting> data) {
                mView.showMeettings(data);
            }
        }, params));
    }
}
